package com.fp.m7.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name = "comments")
public class Comment extends EntityBase implements com.fp.m7.api.model.Comment {
    private static final long serialVersionUID = 2556446331444084432L;

    private Account author;
    private String content;

    public Comment() {
    }

    public Comment(Account author, String content) {
        this.author = author;
        this.content = content;
    }

    @ManyToOne(optional = false)
    @JoinColumn(name = "account_fk", updatable = false)
    public Account getAuthor() {
        return author;
    }

	public void setAuthor(Account author) {
        this.author = author;
    }
	
	@Override
	public void setAuthor(com.fp.m7.api.model.Account author) {
		setAuthor(author);
	}

    @Column(length = 160, nullable = false, updatable = false)
    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }
    
    @Override
    public Date getIssuedDate() {
    	return auditCD;
    }
    
    @Override
    public void setIssuedDate(Date date) {
    	auditCD = date;
    }

    @Override
    public String toString() {
        return new StringBuilder("Comment [author=").append(author) //
                .append(", content=").append(content) //
                .append(", auditCD=").append(auditCD) //
                .append("]").toString();
    }


}
